﻿using System.Linq;
using Sidvall.Collections;

namespace Sidvall.AuthorizationManager.UI.Entities
{
    public sealed partial class ResourceOptionCollection : Sidvall.AuthorizationManager.UI.Entities.Core.BusinessBaseCollection<ResourceOption>
    {
        #region Public Members
        
        #region AcceptChanges

        public void AcceptChanges()
        {
            global::Sidvall.AuthorizationManager.UI.SystemContextConfig.Current.EntityFacade.ResourceOptionManager.AcceptChanges(this);
        }

        #endregion
        #region Clone

        public ResourceOptionCollection Clone()
        {
            var copySettings = Sidvall.Data.CopySettings.Clone();
            return Copy(copySettings);
        }

        #endregion
        #region Copy

        public ResourceOptionCollection Copy()
        {
            return Copy(null);
        }
        public ResourceOptionCollection Copy(Sidvall.Data.CopySettings copySettings)
        {
            var items = new ResourceOptionCollection();
            Import(items, this, copySettings);
            return items;
        }

        #endregion
        #region Import

        public void Import(System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IResourceOption> items)
        {
            Import(items, null);
        }
        partial void OnAfterImport(System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IResourceOption> source, Sidvall.Data.CopySettings copySettings);
        public void Import(System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IResourceOption> items, Sidvall.Data.CopySettings copySettings)
        {
            Import(this, items, copySettings);
        }
        partial void OnAfterImport(ResourceOptionCollection destination, System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IResourceOption> source, Sidvall.Data.CopySettings copySettings);
        private void Import(ResourceOptionCollection destination, System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IResourceOption> source, Sidvall.Data.CopySettings copySettings)
        {
            global::Sidvall.AuthorizationManager.UI.SystemContextConfig.Current.EntityFacade.ResourceOptionManager.Import(destination, source, copySettings);
            OnAfterImport(destination, source, copySettings);
        }
        partial void OnAfterImport(ResourceOptionCollection destination, ResourceOptionCollection source, Sidvall.Data.CopySettings copySettings);
        private void Import(ResourceOptionCollection destination, ResourceOptionCollection source, Sidvall.Data.CopySettings copySettings)
        {
            Import(destination, source as System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IResourceOption>, copySettings);
            OnAfterImport(destination, source, copySettings);
        }

        #endregion
        #region ValidateAsync

        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync()
        {
            return await global::Sidvall.AuthorizationManager.UI.SystemContextConfig.Current.EntityFacade.ResourceOptionManager.ValidateAsync(this);
        }
        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync(Sidvall.Data.ValidationSettings settings)
        {
            return await global::Sidvall.AuthorizationManager.UI.SystemContextConfig.Current.EntityFacade.ResourceOptionManager.ValidateAsync(this, settings);
        }

        #endregion
        #region Initialize

        public void Initialize()
        {
            global::Sidvall.AuthorizationManager.UI.SystemContextConfig.Current.EntityFacade.ResourceOptionManager.Initialize(this);
        }
        public void Initialize(Sidvall.Data.InitializeSettings settings)
        {
            global::Sidvall.AuthorizationManager.UI.SystemContextConfig.Current.EntityFacade.ResourceOptionManager.Initialize(this, settings);
        }

        #endregion

        #endregion
        #region Constructors

        public ResourceOptionCollection()
        {
        }

        #endregion
    }
}